""" DateNotifier package. """
from PyQt4.QtGui import QPixmap, QIcon

def _QDate2Str(date):
    return "%02d.%02d.%04d" % (date.day(), date.month(), date.year())

def _Str2Int(text, defVal = None):
    try:
        return int(text)
    except ValueError:
        if defVal is not None:
            return defVal
        
        # filter digits and add first null (in case if there is no digits at all) 
        return int('0' + ''.join(ch for ch in text if str.isdigit(ch)))

def _LoadQIcon(name):
    res = QIcon()
    res.addPixmap(QPixmap(name), QIcon.Normal, QIcon.Off)
    return res
